<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div {
      width: 500px;
      height: 500px;
      background-color: pink;
    }
  </style>
</head>

<body>

  <!-- <div>嘿嘿</div> -->

  <input type="text" name="" id="">

  <script>

    // const div = document.querySelector('div')
    // div.addEventListener('mouseenter', function () {
    //   console.log('鼠标经过了')
    // })
    // div.addEventListener('mouseleave', function () {
    //   console.log('鼠标离开了')
    // })


    const inp = document.querySelector('input')
    inp.addEventListener('focus', function () {
      console.log('获得焦点')
    })
    inp.addEventListener('blur', function () {
      console.log('失去')
    })


  </script>

</body>

</html>